package com.example.cherrytest.learn;

import com.alibaba.fastjson.JSON;
import com.example.cherrytest.entity.User;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Bean 实例化示例
 *
 * @author 1999
 * @date 2024/7/30
 */
public class BeanInstantiationDemo {

    public static void main(String[] args) {
        ClassPathXmlApplicationContext classPathXmlApplicationContext = new ClassPathXmlApplicationContext("classpath:/MEAT-INF/bean/bean-instantiation-context.xml");

        User bean = classPathXmlApplicationContext.getBean("user-by-static-method", User.class);

        System.err.println("user-by-static-method:" + JSON.toJSONString(bean));
    }
}
